bitkeeper revision 1.782.1.1 (40519955rMBgGJDIn0x9xwhUTOT17w)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Fri, 12 Mar 2004 11:04:53 +0000 (11:04 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Fri, 12 Mar 2004 11:04:53 +0000 (11:04 +0000)
mkbuildtree:
  Fix mkbuildtree script. No longer depend on broken lndir-rel.
.del-lndir-rel~746e79fa104b53af:
  Delete: xenolinux-2.4.25-sparse/lndir-rel

.rootkeys
xenolinux-2.4.25-sparse/lndir-rel [deleted file]
xenolinux-2.4.25-sparse/mkbuildtree

index 3458df6fc66286ef429e15d244cf6351480ee3f4..791c3005a428a9a5213b9452a15a22b30e555d6b 100644 (file)
--- a/.rootkeys
+++ b/.rootkeys
 3e5a4e68TJJavrunYwTAnLRSBxSYqQ xenolinux-2.4.25-sparse/kernel/panic.c
 3f9d4b44247udoqWEgFkaHiWv6Uvyg xenolinux-2.4.25-sparse/kernel/time.c
 401c059bjLBFYHRD4Py2uM3eA1D4zQ xenolinux-2.4.25-sparse/kernel/timer.c
-3eba8f878XjouY21EkQBXwYBsPsipQ xenolinux-2.4.25-sparse/lndir-rel
 3e6e7c1efbQe93xCvOpOVCnXTMmQ5w xenolinux-2.4.25-sparse/mkbuildtree
 3e5a4e68GxCIaFH4sy01v1wjapetaA xenolinux-2.4.25-sparse/mm/memory.c
 3f108af5VxPkLv13tXpXgoRKALQtXQ xenolinux-2.4.25-sparse/mm/mprotect.c
diff --git a/xenolinux-2.4.25-sparse/lndir-rel b/xenolinux-2.4.25-sparse/lndir-rel
deleted file mode 100755 (executable)
index d0bd863..0000000
Binary files a/xenolinux-2.4.25-sparse/lndir-rel and /dev/null differ
index d9ea5b65105fe36e282ccda21ff38fcb05b04913..a2c048fa97da966c79202bb45f962ff916b06945 100755 (executable)
@@ -49,15 +49,39 @@ abs_to_rel ()
        [ "${DESTPATH##*[^/]}" = "/" ] && DESTPATH=${DESTPATH%?}
 }
 
+# relative_lndir <target_dir>
+# Creates a tree of symlinks in the current working directory that mirror
+# real files in <target_dir>. <target_dir> should be relative to the current
+# working directory. Symlinks in <target_dir> are ignored. Source-control files
+# are ignored.
+relative_lndir ()
+{
+  local SYMLINK_DIR REAL_DIR pref i j
+  SYMLINK_DIR=$PWD
+  REAL_DIR=$1
+  (
+  cd $REAL_DIR
+  for i in `find . -type d | grep -v SCCS`; do
+    [ -d $SYMLINK_DIR/$i ] || mkdir -p $SYMLINK_DIR/$i
+    (
+    cd $i
+    pref=`echo $i | sed -e 's#/[^/]*#../#g' -e 's#^\.##'`
+    for j in `find . -type f -maxdepth 1`; do
+      ln -sf ${pref}${REAL_DIR}/$i/$j ${SYMLINK_DIR}/$i/$j
+    done
+    )
+  done
+  )
+}
 
 [ "$1" == "" ] && { echo "Syntax: $0 <linux tree to xenify>"; exit 1; }
 
 # Get absolute path to the destination directory
 pushd . >/dev/null
 cd ${1}
-AD=`pwd`
+AD=$PWD
 popd >/dev/null
-
+  
 # Get absolute path to the source directory
 AS=`pwd`
 
@@ -71,9 +95,12 @@ for i in `find . -type f -o -type l` ; do rm -f ${AD}/${i#./} ; done
 # We now work from the destination directory
 cd ${AD}
 
+# Remove old symlinks
+for i in `find . -type l`; do rm -f $i; done
+
 # Create symlinks of files and directories which exist in the sparse source
-${AS}/lndir-rel -silent ${RS}
-rm -f mkbuildtree lndir-rel
+relative_lndir ${RS}
+rm -f mkbuildtree
 
 ## There are a whole bunch of special symlinks, mostly for files
 ## which are identical in the i386 and xeno-i386 architecture-dependent
@@ -83,7 +110,7 @@ rm -f mkbuildtree lndir-rel
 rm -rf ${AD}/include/asm-xeno/hypervisor-ifs
 mkdir  ${AD}/include/asm-xeno/hypervisor-ifs
 cd     ${AD}/include/asm-xeno/hypervisor-ifs
-${AS}/lndir-rel -silent ../../../${RS}/../xen/include/hypervisor-ifs
+relative_lndir ../../../${RS}/../xen/include/hypervisor-ifs
 
 # The remainder are the i386 -> xeno-i386 links
 cd ..